<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #ball{
        width: 50px;
        height: 50px;
        background-color: orange;
        border-radius:50% ;
        position: absolute;
        left: 0;
        top: 0;
        }
    </style>
</head>
<body>
    <div id="ball"></div>
    
</body>
</html>
<script>
    let ball = document.getElementById('ball');
    let x = 0;
    let y = 0;
    
    document.addEventListener('keydown',function(event){
        let step = 10;
        switch(event.key){
            case'ArrowUp':
            y -= step;
            break;
            case'ArrowDown':
            y += step;
            break;
            case'ArrowLeft':
            x -= step;
            break;
            case'ArrowRight':
            x += step;
            break;
        }
        ball.style.left = x+'px';
        ball.style.top = y+'px';
    });

</script>